package com.gsafety.library.Base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.gsafety.library.Utils.Log;

public abstract class IBaseFragment extends Fragment
{
    private View rootView;


    @Override
    public void onCreate(@Nullable final Bundle savedInstanceState)
    {

        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
    {
        if (rootView != null)
        {
            return rootView;
        }
        rootView = inflater.inflate(getLayoutId(), container, false);
        initView(getView());
        initData();
        return rootView;
    }

    @Nullable
    @Override
    public View getView()
    {
        return rootView;
    }


    abstract public void initView(View view);
    abstract public void initData();
    abstract public int getLayoutId();
}
